package com.fun.demo.interfaces;

import java.util.Iterator;
import java.util.ServiceLoader;

public class Runner {
    public static void main(String[] args) {
        // 获取接口 和父类得所有子类
        InterfaceImpA a = new InterfaceImpA();
        InterfaceImpB b = new InterfaceImpB();

        if(MyInterface.class.isAssignableFrom(InterfaceImpA.class)){
            System.out.println("a imp MyInterface");
        }
        if(MyInterface.class.isAssignableFrom(b.getClass())){
            System.out.println("b imp MyInterface");
        }

        if(MySuper.class.isAssignableFrom(a.getClass())){
            System.out.println("a extends MySuper");
        }
        if(SSuper.class.isAssignableFrom(b.getClass())){
            System.out.println("b super SSSuper");
        }

        System.out.println(MyInterface.class.isAssignableFrom(Nothing.class));
        System.out.println(MySuper.class.isAssignableFrom(Nothing.class));
        System.out.println(a.getClass().getSuperclass().getName());
        System.out.println(a.getClass().getInterfaces()[0]);
    }
}
